<script setup>
import AMapLoader from "@amap/amap-jsapi-loader";
import { computed, ref } from "vue";
import { useStore } from "vuex";
const store = useStore();
const username = computed(() => store.getters.username);

AMapLoader.load({
  // 该 key 是 jiaying.jiang 申请的，后续需要替换为公司公用的
  key: "de4b8f2c272cf4dd9f94b4791f5325fd", // 申请好的Web端开发者Key，首次调用 load 时必填
  version: "2.0", // 指定要加载的 JSAPI 的版本，缺省时默认为 1.4.15
  plugins: [],
})
  .then((AMap) => {
    new AMap.Map("container");
  })
  .catch((e) => {
    console.log(e);
  });
</script>

<template>
  <p>
    来自 vuex store 的 username: <strong>{{ username }}</strong>
  </p>

  <a-button type="primary" ghost><router-link to="@/views/welcome">点我返回</router-link></a-button>

  <div id="container" class="map"></div>
</template>

<style lang="scss" scoped>
.map {
  height: 300px;
}
</style>
